1. Technical Field
This disclosure generally relates to database systems, and more specifically relates to executing queries in database systems.
2. Background Art
Databases are computerized information storage and retrieval systems. A database system is structured to accept commands to store, retrieve and delete data using, for example, high-level query languages such as the Structured Query Language (SQL). The term “query” denotes a command for retrieving data from a stored database. The query language requires the return of a particular result set in response to a particular query.
Optimization and execution of a database query can be a resource-intensive and time-consuming process. Further, the larger the database, the longer the time needed to execute the query. In order to prevent an excessive drain on resources, many databases are configured with query governors. A query governor prevents the execution of large and resource-intensive queries by referencing a defined time threshold. If the cost of executing a query exceeds the time threshold, known query governors prevent execution of the query. A simple example will illustrate. Let's assume a query governor has a defined time threshold of two seconds. If the best access plan generated by a query optimizer takes over two seconds for the query to execute, the query governor will prevent execution of the query, and will typically return a message to the user that attempted to run the query indicating the query would take too long to execute. The user can then attempt to modify the query and execute the modified query in the hopes the modified query will run in under two seconds. However, this is a manual trial-and-error approach that is inefficient and error-prone.